**Day 15_指定運算子 (Assignment Operators)
15-1. a += b 等於 a = a + b
式子:
a = 1
b = 2
a += b
print('a =', a)
結果:
a = 3
15-2. a -= b 等於 a = a - b
式子:
a = 1
b = 2
a -= 2
print('a =', a)
結果:
a = -1
*15-3. a = b 等於 a = a * b
式子:
a = 1
b = 2
a *= 2
print('a =', a)
結果:
a = 2
15-4. a /= b 等於 a = a / b
式子:
a = 1
b = 2
a /= 2
print('a =', a)
結果:
a = 0.5
15-5. a %= b 等於 a = a % b
式子:
a = 1
b = 2
a %= 2
print('a =', a)
結果:
a = 1
15-6. a //= b 等於 a = a // b
式子:
a = 1
b = 2
a //= 2
print('a =', a)
結果:
a = 0
15-7. a * * = b 等於 a = a * * b
式子:
a = 1
b = 2
a **= b
print('a =', a)
結果:
a = 1